﻿@{
   Layout = null;
}

@model ElingOA6_Admin_DSJCJ.Model.SysTemplate
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
<title>@ElingOA6_Admin_DSJCJ.Common.GlobalConstant.CONSTRING_SYSTITLE</title>
<link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>
<script src="@Url.Content("~/Fckeditor/fckeditor.js", true)" type="text/javascript"></script>
<script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>

@Html.DevExpress().GetStyleSheets(

        new StyleSheet { ExtensionType = ExtensionType.ListBox, Theme = DevExpressHelper.Theme }
)
@Html.DevExpress().GetScripts(
        new Script { ExtensionType = ExtensionType.ListBox }
)


<script type="text/javascript">

    $(function () {
        var oFCKeditor = new FCKeditor('fFContent');
        oFCKeditor.BasePath = rootPath + "/Fckeditor/";
        //oFCKeditor.UserFilesPath = "/upload_file/";
        oFCKeditor.ToolbarSet = "Video";
        oFCKeditor.Height = 500;
        oFCKeditor.ReplaceTextarea();

    });

    function MenuTop_emClick(source, e) {
        switch (e.item.name) {
            case "btnSave":
                {
                    lpModal.Show();
                    //保存
                    var file = FTitle.GetText();
                    if (file == null || ASPxClientUtils.Trim(file) == "") {
                        FTitle.SetErrorText("请填写模板名称");
                        FTitle.SetIsValid(false);
                        lpModal.Hide();
                        return;
                    }

                    form1.submit();

                    break;
                }
            case "btnClose":
                {
                    //关闭
                    window.close();
                    break;
                }
        }
    }




</script>


</head>
<body>
@using (Html.BeginForm("HtmlTemplateSave", "SysTemplate", FormMethod.Post, new { id = "form1" }))
{ 
<div class="floatToolMenu" id="toolMenu">
       @Html.DevExpress().Menu(settings =>
       {
           settings.Name = "toolBarMenu";
           settings.ItemAutoWidth = false;
           settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
           settings.Styles.Style.Border.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(0);
           settings.Styles.Style.BorderTop.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(1);

           settings.Items.Add(item =>
           {
               item.Name = "btnSave";
               item.Text = "保存";
               item.ClientEnabled = true;
               item.Image.Url = Url.Content("~/Content/ControlImages/filesave.png");
           });
           settings.Items.Add(item =>
           {
               item.Name = "btnClose";
               item.Text = "关闭";
               item.ClientEnabled = true;
               item.Image.Url = Url.Content("~/Content/ControlImages/no.png");

           });

           settings.ClientSideEvents.ItemClick = "function(source,e){MenuTop_emClick(source,e)}";
           settings.ItemLinkMode = ItemLinkMode.ContentBounds;
       }).GetHtml()
        </div>           
        
        <table class="tableFrom">
        <tr>
            <th width="100px">模板名称:</th>
            <td>
               @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FTitle";
                   settings.Width = 200;
                   settings.Text = Model.FTitle;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
               }).GetHtml()
        
           </td>
           <td>
                          @Html.DevExpress().CheckBox(settings =>
               {
                   settings.Name = "FIsDefault";
                   settings.Width = 200;
                   settings.Text = "默认";
                   if (Model.FIsDefault == "Y")
                   {
                       settings.Checked = true;
                   }
                   else {
                       settings.Checked = false;
                   }
                       
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
               }).GetHtml()
           </td>
           
        </tr>
      </table>
    
      <table width="100%">
        <tr>
            <td>
            @Html.TextArea("fFContent", Model.FContent == null ? "" :  System.Text.Encoding.Default.GetString(Model.FContent), new { @cols = "30", @rows = "10" })
            </td>
        </tr>
      </table>
    
        @Html.Hidden("FSourceNo", Model.FSourceNo)
        @Html.Hidden("FTemplateID", Model.FTemplateID)
    
}

@Html.DevExpress().LoadingPanel(settings =>
{
    settings.Name = "lpModal";
    settings.Modal = true;
    settings.Text = "数据保存中...";
}).GetHtml()

</body>
</html>